package com.breeze.mvxdemo.mvp;

import com.breeze.mvxdemo.bean.Account;
import com.breeze.mvxdemo.callbacks.AccountCallback;

public class MVPPresenter implements MVPContract.IMVPPresenter {
    private MVPContract.IMVPView mvpView;
    private MVPContract.IMVPModel mvpModel;

    public MVPPresenter(MVPContract.IMVPView mvpView) {
        this.mvpView = mvpView;
        mvpModel = new MVPModel();
    }

    @Override
    public void getAccountData(String accountName) {
        mvpModel.getAccountData(accountName, new AccountCallback() {
            @Override
            public void onSuccess(Account account) {
                mvpView.showSuccessPage(account);
            }

            @Override
            public void onFailed() {
                mvpView.showFailedPage();
            }
        });
    }
}
